<template>
  <ul class="RightList-comtainer">
    <li v-for="(item, i) in list" :key="i">
      <span @click="handleClick(item)" :class="{ active: item.isSelect }">{{
        item.name
      }}</span>
      <span v-if="item.aside" :class="{ active: item.isSelect }" class="aside"
        >{{ item.aside }}篇</span
      >
      <RightList :list="item.children" @select="handleClick" />
    </li>
  </ul>
</template>

<script>
export default {
  name: "RightList",
  props: {
    list: {
      type: Array,
      default: () => [],
    },
  },
  methods: {
    handleClick(item) {
      this.$emit("select", item);
    },
  },
};
</script>

<style lang="less" scoped>
@import "~@/styles/var.less";
.RightList-comtainer {
  padding: 0;
  list-style: none;
  .RightList-comtainer {
    margin-left: 1em;
  }
  li {
    min-height: 45px;
    line-height: 45px;
    span{
      cursor: pointer;
      transition: all 0.4s;
    }
    span.active {
      font-weight: bold;
      font-size: 18px;
    }
    .aside {
      font-size: 12px;
      margin-left: 8px;
      color: #ccc;
    }
  }
}
</style>
